package com.goods.controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.goods.model.GoodsService;
import com.goodsColorClass.model.GoodsColorClassService;

/**
 * Servlet implementation class GoodsImgServlet
 */
public class GoodsImgServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

    public GoodsImgServlet() {
        super();
       
    }

	protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
		doPost(req,res);
	}


	protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
		ServletOutputStream out = res.getOutputStream();
			res.setContentType("image/jpg");
			
			String colName = req.getParameter("colName");
			String imgName = req.getParameter("imgName");
			String imgFile = req.getParameter("imgFile");
System.out.println("colNameXXXXX"+colName);
			GoodsColorClassService colorSvc = new GoodsColorClassService();
			byte[] imgColor = colorSvc.getImg(colName,imgName,imgFile);
System.out.println("imgColorXXXXX"+imgColor);
			out.write(imgColor);
		
		
	}//end of doPost()

}//end of class GoodsImgServlet
